Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: statusBar style fixing #806

Open
wants to merge 2 commits into
base: develop
Choose a base branch
from

Conversation

abdulbasithqb
Copy link

Enhance chooseBarStyle function in React Native component library to dynamically set the navigation bar style to 'light-content' when the background color is light, ensuring improved visibility and maintaining design consistency across diverse backgrounds."

fixes: #478

@tomislav-arambasic
Copy link
Contributor

tomislav-arambasic commented Dec 27, 2023

@abdulbasithqb Thanks for creating a PR for this.

@sstimac @Definitely-Not-Vlad
This looks like a right change to me.
It doesn't change anything for iOS, but does on Androids.
default style for iOS is dark and light for Android, meaning that, currently, we never switch to dark StatusBar style on Androids.

I don't see why we shouldn't merge this in, unless there was a specific reason behind implementing default style that I'm not aware of?
I believe all Androids have solid Status Bar background, so the style would be just a matter of personal preference, no UI breaking changes no matter of style chosen.

Edit:
For this to work on Android, we'll have to remove else statement on line 35. It should be like this:

if (Platform.OS === 'android') {
  StatusBar.setBackgroundColor('rgba(0, 0, 0, 0.2)');
}

const barStyle = chooseBarStyle(color);
StatusBar.setBarStyle(barStyle);

I'd merge this change now, but also try to figure out a better way to style out Status Bar, while also exposing the StatusBar backgroundColor and style via props of NavigationBar component.
Or remove status bar logic completely and let implementations take care of it...

@tomislav-arambasic
Copy link
Contributor

@abdulbasithqb
We can merge your changes. However, I need you to confirm that changes in this PR are fixing it for you.

I don't see how you get Status Bar changed on Android because of if-else condition.
On Androids, it never enters else condition on line 35 - never sets resolved bar style.

If above is true, please adjust your PR and verify everything works as expected.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

StatusBar style fixing
2 participants